import request from '../request'
import type { TaskSubmissionVO, SubmissionQueryParams, SubmissionReviewDTO } from '@/types/taskSubmission'
import type { PageResult } from '@/types/api'

export const taskSubmissionApi = {
  // 分页查询提交记录
  getPage: (params: SubmissionQueryParams) => {
    return request<PageResult<TaskSubmissionVO>>({
      url: '/v1/task-submissions/page',
      method: 'get',
      params
    })
  },

  // 获取提交详情
  getById: (id: number) => {
    return request<TaskSubmissionVO>({
      url: `/v1/task-submissions/${id}`,
      method: 'get'
    })
  },

  // 审核提交
  review: (id: number, data: SubmissionReviewDTO) => {
    return request({
      url: `/v1/task-submissions/${id}/review`,
      method: 'put',
      data
    })
  },

  // 批量审核
  batchReview: (ids: number[], data: SubmissionReviewDTO) => {
    return request({
      url: '/v1/task-submissions/batch/review',
      method: 'put',
      data: {
        ids,
        dto: data
      }
    })
  }
} 